import { ExtractPropTypes, InjectionKey, Ref } from 'vue'

interface checkboxGroupInjection {
  disabled: Ref<boolean>
  isTitle: Ref<boolean>
  direction: Ref<string>
  checks: Ref<(string | number)[]>
  changeHandle: (value: (string | number)[]) => void
}

export const checkboxGroupInjectionKey: InjectionKey<checkboxGroupInjection> = Symbol('fs-checkbox-group')

export const checkboxGroupProps = {
  modelValue: {
    type: Array<string | number>,
    default: []
  },
  halfChecked: {
    type: Boolean,
    default: false
  },
  disabled: {
    type: Boolean,
    default: false
  },
  isTitle: {
    type: Boolean,
    default: true
  },
  direction: {
    type: String, //'row' | 'column'
    default: 'row'
  },
  onChange: {
    type: Function,
    default: undefined
  }
}

export type CheckboxGroupProps = ExtractPropTypes<typeof checkboxGroupProps>

export const checkboxGroupEmit = ['update:modelValue', 'change']

export type CheckboxGroupEmit = typeof checkboxGroupEmit
